// ALIBEAM.h file 
#ifndef ALIBEAM_h
	#define ALIBEAM_h
	#include <Arduino.h>

	// these constants won't change:
	#define ALIBE_X_AXIS_PIN 		5		// X output of the accelerometer
	#define ALIBE_Y_AXIS_PIN  		6		// Y output of the accelerometer
	#define ALIBE_TEMPERATURE_PIN 	0   	// Temp reading on Analog 0

	#define ALIBE_MOTION_LEVEL_THRESHOLD	5   // max count of motions to occur before determining whether moving vs not.
	#define ALIBE_X_THRESHOLD				20  // this is the threshold on x-axis before we detremine movement
	#define ALIBE_Y_THRESHOLD				20  // this is the threshold on y-axis before we detremine movement

	#define ALIBE_DOWNWARD_SLOPE_THRESHOLD  -360
	#define ALIBE_UPWARD_SLOPE_THRESHOLD	360
	#define ALIBE_TILT_LEFT_THRESHOLD		-300
	#define ALIBE_TILT_RIGHT_THRESHOLD		360
	
	class ALIBEAM  {
		public:
			ALIBEAM();
			void begin();
			bool isMoving();
			int  temperature();
			int  xG();
			int  yG();
			bool isDownwardSlope();
			bool isUpwardSlope();
			bool isTiltedLeft();
			bool isTiltedRight();
			void readValues();

		private:
			int xInitial, yInitial;
			int xAcceleration, yAcceleration;
			int temp;
			
			void initAndCaliberate();
	};
#endif